/*
 * Copyright 2020-2021 redragon.dongbin
 *
 * This file is part of redragon-erp/赤龙ERP.

 * redragon-erp/赤龙ERP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.

 * redragon-erp/赤龙ERP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with redragon-erp/赤龙ERP.  If not, see <https://www.gnu.org/licenses/>.
 */
package com.erp.ledger.balance.dao.model;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@Table(name="gl_balance", schema="erp")
@DynamicInsert(true)
@DynamicUpdate(true)
public class GLBalance implements java.io.Serializable {

    //serialVersionUID
    private static final long serialVersionUID = 1L;

    //Constructors
    public GLBalance() {
    }
    
    //Fields
    
    //主键
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "balance_id", unique = true, nullable = false)
    private Integer balanceId;
    
    public Integer getBalanceId() {
        return this.balanceId;
    }
    public void setBalanceId(Integer balanceId) {
        this.balanceId = balanceId;
    }
    
    //编码
    @NotBlank(message="编码不能为空")
    @Column(name = "balance_code", unique = true, nullable = false, length = 45)
    private String balanceCode;
    
    public String getBalanceCode() {
        return this.balanceCode;
    }
    public void setBalanceCode(String balanceCode) {
        this.balanceCode = balanceCode;
    }
    
    //分类账簿编码
    @NotBlank(message="分类账簿不能为空")
    @Column(name = "ledger_code", unique = false, nullable = false, length = 45)
    private String ledgerCode;
    
    public String getLedgerCode() {
        return this.ledgerCode;
    }
    public void setLedgerCode(String ledgerCode) {
        this.ledgerCode = ledgerCode;
    }
    
    //会计科目结构编码
    @NotBlank(message="会计科目结构编码不能为空")
    @Column(name = "subject_code", unique = false, nullable = false, length = 45)
    private String subjectCode;
    
    public String getSubjectCode() {
        return this.subjectCode;
    }
    public void setSubjectCode(String subjectCode) {
        this.subjectCode = subjectCode;
    }
    
    //币种
    @NotBlank(message="币种不能为空")
    @Column(name = "currency_code", unique = false, nullable = false, length = 45)
    private String currencyCode;
    
    public String getCurrencyCode() {
        return this.currencyCode;
    }
    public void setCurrencyCode(String currencyCode) {
        this.currencyCode = currencyCode;
    }
    
    //会计期间
    @NotBlank(message="会计期间不能为空")
    @Column(name = "period_name", unique = false, nullable = false, length = 45)
    private String periodName;
    
    public String getPeriodName() {
        return this.periodName;
    }
    public void setPeriodName(String periodName) {
        this.periodName = periodName;
    }
    
    //本期发生（借）
    //@NotNull(message="本期发生（借）不能为空")
    @Column(name = "period_dr", unique = false, nullable = false)
    private Double periodDr = 0D;
    
    public Double getPeriodDr() {
        return this.periodDr;
    }
    public void setPeriodDr(Double periodDr) {
        this.periodDr = periodDr;
    }
    
    //本期发生（贷）
    //@NotNull(message="本期发生（贷）不能为空")
    @Column(name = "period_cr", unique = false, nullable = false)
    private Double periodCr = 0D;
    
    public Double getPeriodCr() {
        return this.periodCr;
    }
    public void setPeriodCr(Double periodCr) {
        this.periodCr = periodCr;
    }
    
    //本季度余额（借）
    //@NotNull(message="本季度余额（借）不能为空")
    @Column(name = "quarter_dr", unique = false, nullable = false)
    private Double quarterDr = 0D;
    
    public Double getQuarterDr() {
        return this.quarterDr;
    }
    public void setQuarterDr(Double quarterDr) {
        this.quarterDr = quarterDr;
    }
    
    //本季度余额（贷）
    //@NotNull(message="本季度余额（贷）不能为空")
    @Column(name = "quarter_cr", unique = false, nullable = false)
    private Double quarterCr = 0D;
    
    public Double getQuarterCr() {
        return this.quarterCr;
    }
    public void setQuarterCr(Double quarterCr) {
        this.quarterCr = quarterCr;
    }
    
    //账簿余额（借）
    //@NotNull(message="账簿余额（借）不能为空")
    @Column(name = "ledger_dr", unique = false, nullable = false)
    private Double ledgerDr = 0D;
    
    public Double getLedgerDr() {
        return this.ledgerDr;
    }
    public void setLedgerDr(Double ledgerDr) {
        this.ledgerDr = ledgerDr;
    }
    
    //账簿余额（贷）
    //@NotNull(message="账簿余额（贷）不能为空")
    @Column(name = "ledger_cr", unique = false, nullable = false)
    private Double ledgerCr = 0D;
    
    public Double getLedgerCr() {
        return this.ledgerCr;
    }
    public void setLedgerCr(Double ledgerCr) {
        this.ledgerCr = ledgerCr;
    }
    
    //期初余额（借）
    //@NotNull(message="期初余额（借）不能为空")
    @Column(name = "begin_dr", unique = false, nullable = false)
    private Double beginDr = 0D;
    
    public Double getBeginCr() {
        return beginCr;
    }
    public void setBeginCr(Double beginCr) {
        this.beginCr = beginCr;
    }

    //期初余额（贷）
    //@NotNull(message="期初余额（贷）不能为空")
    @Column(name = "begin_cr", unique = false, nullable = false)
    private Double beginCr = 0D;
    
    public Double getBeginDr() {
        return beginDr;
    }
    public void setBeginDr(Double beginDr) {
        this.beginDr = beginDr;
    }

    //来源日记账头编码
    //@NotBlank(message="日记账头编码不能为空")
    @Column(name = "je_head_code", unique = false, nullable = false, length = 45)
    private String jeHeadCode;
    
    public String getJeHeadCode() {
        return this.jeHeadCode;
    }
    public void setJeHeadCode(String jeHeadCode) {
        this.jeHeadCode = jeHeadCode;
    }
    
    //来源日记账行编码
    //@NotBlank(message="日记账行编码不能为空")
    @Column(name = "je_line_code", unique = false, nullable = false, length = 45)
    private String jeLineCode;
    
    public String getJeLineCode() {
        return this.jeLineCode;
    }
    public void setJeLineCode(String jeLineCode) {
        this.jeLineCode = jeLineCode;
    }
    
    //实际标识
    //@NotBlank(message="实际标识不能为空")
    @Column(name = "actual_flag", unique = false, nullable = false, length = 1)
    private String actualFlag;
    
    public String getActualFlag() {
        return this.actualFlag;
    }
    public void setActualFlag(String actualFlag) {
        this.actualFlag = actualFlag;
    }
    
    //版本
    @Column(name = "version", unique = false, nullable = false)
    private Integer version;
    
    public Integer getVersion() {
        return this.version;
    }
    public void setVersion(Integer version) {
        this.version = version;
    }
    
    //状态
    @Column(name = "status", unique = false, nullable = false, length = 1)
    private String status;
    
    public String getStatus() {
        return this.status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    
    //创建时间
    @Column(name = "created_date", unique = false, nullable = false)
    private Date createdDate;
    
    public Date getCreatedDate() {
        return this.createdDate;
    }
    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }
    
    //创建人
    @Column(name = "created_by", unique = false, nullable = false, length = 45)
    private String createdBy;
    
    public String getCreatedBy() {
        return this.createdBy;
    }
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }
    
    //最后修改时间
    @Column(name = "last_updated_date", unique = false, nullable = true)
    private Date lastUpdatedDate;
    
    public Date getLastUpdatedDate() {
        return this.lastUpdatedDate;
    }
    public void setLastUpdatedDate(Date lastUpdatedDate) {
        this.lastUpdatedDate = lastUpdatedDate;
    }
    
    //最后修改人
    @Column(name = "last_updated_by", unique = false, nullable = true, length = 45)
    private String lastUpdatedBy;
    
    public String getLastUpdatedBy() {
        return this.lastUpdatedBy;
    }
    public void setLastUpdatedBy(String lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }
    
    //组织机构
    @Column(name = "org_code", unique = false, nullable = false, length = 45)
    private String orgCode;
    
    public String getOrgCode() {
        return this.orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    
    //法人主体
    @Column(name = "legal_code", unique = false, nullable = false, length = 45)
    private String legalCode;
    
    public String getLegalCode() {
        return this.legalCode;
    }
    public void setLegalCode(String legalCode) {
        this.legalCode = legalCode;
    }
    
    
    
    /*
         * 显示的字段
     */
    @Transient
    private String ledgerName;
    @Transient
    private String subjectDesc;
    @Transient
    private String subjectDescTitle;
    @Transient
    private Double endDr = 0D;
    @Transient
    private Double endCr = 0D;

    public String getLedgerName() {
        return ledgerName;
    }
    public void setLedgerName(String ledgerName) {
        this.ledgerName = ledgerName;
    }
    public String getSubjectDesc() {
        return subjectDesc;
    }
    public void setSubjectDesc(String subjectDesc) {
        this.subjectDesc = subjectDesc;
    }
    public String getSubjectDescTitle() {
        return subjectDescTitle;
    }
    public void setSubjectDescTitle(String subjectDescTitle) {
        this.subjectDescTitle = subjectDescTitle;
    }
    public Double getEndDr() {
        return endDr;
    }
    public void setEndDr(Double endDr) {
        this.endDr = endDr;
    }
    public Double getEndCr() {
        return endCr;
    }
    public void setEndCr(Double endCr) {
        this.endCr = endCr;
    }
    
}